package library.operation;

import library.Book;
import library.BookList;

import java.util.Scanner;

//新增书籍
public class AddOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("新增书籍");
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入书籍书名：");
        String Name = scanner.next();
        System.out.println("请输入书籍作者：");
        String Author = scanner.next();
        System.out.println("请输入书籍价格：");
        Double Price = scanner.nextDouble();
        System.out.println("请输入书籍类型：");
        String Type = scanner.next();
        Book book = new Book(Name,Author,Price,Type);
        int size = bookList.getSize();
        bookList.setBook(size,book);
        bookList.setSize(size + 1);
        System.out.println("新增书籍成功！");
    }
}
